﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Linq;

namespace helpcarla
{
    public partial class frmFeedback : Form
    {
        public frmFeedback()
        {
            InitializeComponent();
        }

        TextBox txtbox = new TextBox();

        private void cbFeedbackList_SelectionChangeCommitted(object sender, EventArgs e)
        {
            this.Size = new Size(450, 338);

            txtbox.Name = "txtFeedback";
            txtbox.Multiline = true;
            txtbox.Size = new Size(410, 194);
            txtbox.Location = new Point(12, 58);

            Button btnSend = new Button();
            btnSend.Name = "btnSendFeedback";
            btnSend.Text = "Send Feedback";
            btnSend.Size = new Size(75, 23);
            btnSend.Location = new Point(103, 267);
            btnSend.Click += new EventHandler(btnSubmitFeedback_Click);

            Button btnCancel = new Button();
            btnCancel.Name = "btnCancel";
            btnCancel.Text = "Cancel";
            btnCancel.Size = new Size(75, 23);
            btnCancel.Location = new Point(248, 267);
            btnCancel.Click += new EventHandler(btnCancel_Click);

            this.Controls.Add(txtbox);
            this.Controls.Add(btnSend);
            this.Controls.Add(btnCancel);
        }

        private void frmFeedback_Load(object sender, EventArgs e)
        {
            cbFeedbackList.Text = "-- Please Select the Type of Feedback --";
        }

        private void btnSubmitFeedback_Click(object sender, EventArgs e)
        {
            try
            {
                SmtpClient smtp = new SmtpClient("smtp.1and1.com");
                MailMessage message = new MailMessage("mailer@imaslog.com", "cheatcountry@gmail.com");
                message.Subject = "Carla Healer's Feedback for " + cbFeedbackList.SelectedItem;
                message.Body = txtbox.Text;
                System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("mailer@imaslog.com", "xESp3maheh3#a?EVuthu+EchafApr!?4&ruf=-juPhumamusta=r6fA?7@aP+&=!");
                smtp.Credentials = credentials;
                smtp.Send(message);
            }
            catch (SmtpException smtpex)
            {
                MessageBox.Show("An error occurred while sending feedback: " + smtpex.Message);
            }
            MessageBox.Show("Your feedback has been sent");
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
